#!/bin/bash
#定制Rocky初始化脚本

#1.更新软件源
yum update

#2.关闭防火墙
systemctl stop firewalld
systemctl disable firewalld

#3.安装tab补全工具
yum install bash-completion -y
source /etc/profile.d/bash_completion.sh

#4.安装SSH服务
yum install openssh-server -y
echo "PermitRootLogin yes" >> /etc/ssh/sshd_config
systemctl restart sshd

#5.设置PS1
echo "PS1='\[\033[36m\]当前位置：\[\033[31m\]\w \[\033[0m\]\n[\[\033[32m\]\u@\[\033[33m\]\h \[\033[36m\]\t \[\033[0m\]]\$ '" >> /root/.bashrc

source /root/.bashrc

#6.设置root密码
echo "root:123456" | chpasswd

#7.设置主机名
hostnamectl  set-hostname rocky

